<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>class RubyVM::RJIT::Invariants - ruby_vm: Ruby Standard Library Documentation</title>


<script src="../../js/navigation.js" defer></script>
<script src="../../js/search.js" defer></script>
<script src="../../js/search_index.js" defer></script>
<script src="../../js/searcher.js" defer></script>
<script src="../../js/darkfish.js" defer></script>

<script src="../../js/jquery-3.2.0.min.js"></script>

<script src="../../js/vue.min.js"></script>
<script src="../../js/js.cookie.min.js"></script>

<link href="../../css/fonts.css" rel="stylesheet">
<link id='rdoccss' href="../../css/rdoc.css" rel="stylesheet">
<link href="../../css/carbon17.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "../../";
  var index_rel_prefix = "../../";
  var darkModeCsseHref = "../../css/rdoc-dm.css"
  var defaultModeCssHref = "../../css/rdoc.css"
  // var cssDarkmode = Cookies.get('darkmode');
  
  if( Cookies.get("darkmode") == "true") {
	$('#rdoccss').attr("href", darkModeCsseHref);
}

//  https://cssdeck.com/blog/simple-jquery-stylesheet-switcher/

document.write('<style type="text/css">body{display:none}</style>');

</script>


</head>
<body id="top" role="document" class="class">
  <!-- this is class.html -->

  <div id='actionbar' >
    <div class='wrapper mdiv'>
      <ul class='grids g0'></ul>
    </div> 
    <!-- VERSION HEADER for 3.3.0.preview2 NOT FOUND -->
  </div> <!-- end action bar -->

  <div class='wrapper hdiv'>

    


    <nav id='vapp' role="navigation">
    <div id="project-navigation">
      <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2><a href="../../index.html" rel="home">Home</a></h2>

  <div id="table-of-contents-navigation"  >
    <a href="../../table_of_contents.html#pages">Pages</a>
    <a href="../../table_of_contents.html#classes">Classes</a>
    <a href="../../table_of_contents.html#methods">Methods</a>
  </div>
</div>

      <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

    </div>


    

    <button id='toggleThing' @click="toggleNav()" >Show/hide navigation</button>
    <div :class="isOpen ? 'block' : 'hidden' " id='toggleMe'>
      <div id="class-metadata">
        
        
<div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  <p class="link">Object
</div>

        
        
        
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    <li ><a href="#method-c-assume_bop_not_redefined">::assume_bop_not_redefined</a>
    <li ><a href="#method-c-assume_method_basic_definition">::assume_method_basic_definition</a>
    <li ><a href="#method-c-assume_method_lookup_stable">::assume_method_lookup_stable</a>
    <li ><a href="#method-c-assume_stable_constant_names">::assume_stable_constant_names</a>
    <li ><a href="#method-c-ensure_block_entry_exit">::ensure_block_entry_exit</a>
    <li ><a href="#method-c-initialize">::initialize</a>
    <li ><a href="#method-c-invalidate_all">::invalidate_all</a>
    <li ><a href="#method-c-on_cme_invalidate">::on_cme_invalidate</a>
    <li ><a href="#method-c-on_constant_ic_update">::on_constant_ic_update</a>
    <li ><a href="#method-c-on_constant_state_changed">::on_constant_state_changed</a>
    <li ><a href="#method-c-on_tracing_invalidate_all">::on_tracing_invalidate_all</a>
    <li ><a href="#method-c-on_update_references">::on_update_references</a>
    <li ><a href="#method-c-record_global_inval_patch">::record_global_inval_patch</a>
  </ul>
</div>

      </div>
     </div>
    </nav>


    <div id='extraz'><div class='adzbox-index'  >
      
     </div>         
    </div>

    <main role="main" aria-labelledby="class-RubyVM::RJIT::Invariants">
    <h1 id="class-RubyVM::RJIT::Invariants" class="class">
      class RubyVM::RJIT::Invariants
    </h1>

    <section class="description">
    
    </section>

      <section id="5Buntitled-5D" class="documentation-section">





                <section id="public-class-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Class Methods</h3>
                </header>

                  <div id="method-c-assume_bop_not_redefined" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assume_bop_not_redefined</span><span
                                class="method-args">(jit, klass, op)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>@param jit [RubyVM::RJIT::JITState] @param klass [Integer] @param op [Integer]</p>

                              <div class="method-source-code" id="assume_bop_not_redefined-source">
            <pre><span class="ruby-comment"># File ruby_vm/rjit/invariants.rb, line 27</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assume_bop_not_redefined</span>(<span class="ruby-identifier">jit</span>, <span class="ruby-identifier">klass</span>, <span class="ruby-identifier">op</span>)
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">false</span> <span class="ruby-keyword">unless</span> <span class="ruby-constant">C</span>.<span class="ruby-constant">BASIC_OP_UNREDEFINED_P</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">op</span>)

  <span class="ruby-identifier">ensure_block_entry_exit</span>(<span class="ruby-identifier">jit</span>, <span class="ruby-value">cause:</span> <span class="ruby-string">&#39;assume_bop_not_redefined&#39;</span>)
  <span class="ruby-ivar">@bop_blocks</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">jit</span>.<span class="ruby-identifier">block</span>
  <span class="ruby-keyword">true</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-assume_method_basic_definition" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assume_method_basic_definition</span><span
                                class="method-args">(jit, klass, mid)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>@param jit [RubyVM::RJIT::JITState]</p>

                              <div class="method-source-code" id="assume_method_basic_definition-source">
            <pre><span class="ruby-comment"># File ruby_vm/rjit/invariants.rb, line 42</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assume_method_basic_definition</span>(<span class="ruby-identifier">jit</span>, <span class="ruby-identifier">klass</span>, <span class="ruby-identifier">mid</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-constant">C</span>.<span class="ruby-identifier">rb_method_basic_definition_p</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">mid</span>)
    <span class="ruby-identifier">cme</span> = <span class="ruby-constant">C</span>.<span class="ruby-identifier">rb_callable_method_entry</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">mid</span>)
    <span class="ruby-identifier">assume_method_lookup_stable</span>(<span class="ruby-identifier">jit</span>, <span class="ruby-identifier">cme</span>)
    <span class="ruby-keyword">true</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-keyword">false</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-assume_method_lookup_stable" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assume_method_lookup_stable</span><span
                                class="method-args">(jit, cme)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>@param jit [RubyVM::RJIT::JITState]</p>

                              <div class="method-source-code" id="assume_method_lookup_stable-source">
            <pre><span class="ruby-comment"># File ruby_vm/rjit/invariants.rb, line 36</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assume_method_lookup_stable</span>(<span class="ruby-identifier">jit</span>, <span class="ruby-identifier">cme</span>)
  <span class="ruby-identifier">ensure_block_entry_exit</span>(<span class="ruby-identifier">jit</span>, <span class="ruby-value">cause:</span> <span class="ruby-string">&#39;assume_method_lookup_stable&#39;</span>)
  <span class="ruby-ivar">@cme_blocks</span>[<span class="ruby-identifier">cme</span>.<span class="ruby-identifier">to_i</span>] <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">jit</span>.<span class="ruby-identifier">block</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-assume_stable_constant_names" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assume_stable_constant_names</span><span
                                class="method-args">(jit, idlist)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="assume_stable_constant_names-source">
            <pre><span class="ruby-comment"># File ruby_vm/rjit/invariants.rb, line 52</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assume_stable_constant_names</span>(<span class="ruby-identifier">jit</span>, <span class="ruby-identifier">idlist</span>)
  (<span class="ruby-value">0</span><span class="ruby-operator">..</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">break</span> <span class="ruby-keyword">if</span> (<span class="ruby-identifier">id</span> = <span class="ruby-identifier">idlist</span>[<span class="ruby-identifier">i</span>]) <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
    <span class="ruby-ivar">@const_blocks</span>[<span class="ruby-identifier">id</span>] <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">jit</span>.<span class="ruby-identifier">block</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-ensure_block_entry_exit" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">ensure_block_entry_exit</span><span
                                class="method-args">(jit, cause:)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>@param jit [RubyVM::RJIT::JITState] @param block [RubyVM::RJIT::Block]</p>

                              <div class="method-source-code" id="ensure_block_entry_exit-source">
            <pre><span class="ruby-comment"># File ruby_vm/rjit/invariants.rb, line 119</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">ensure_block_entry_exit</span>(<span class="ruby-identifier">jit</span>, <span class="ruby-value">cause:</span>)
  <span class="ruby-identifier">block</span> = <span class="ruby-identifier">jit</span>.<span class="ruby-identifier">block</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">block</span>.<span class="ruby-identifier">entry_exit</span>.<span class="ruby-identifier">nil?</span>
    <span class="ruby-identifier">block</span>.<span class="ruby-identifier">entry_exit</span> = <span class="ruby-constant">Assembler</span>.<span class="ruby-identifier">new</span>.<span class="ruby-identifier">then</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">asm</span><span class="ruby-operator">|</span>
      <span class="ruby-ivar">@exit_compiler</span>.<span class="ruby-identifier">compile_entry_exit</span>(<span class="ruby-identifier">block</span>.<span class="ruby-identifier">pc</span>, <span class="ruby-identifier">block</span>.<span class="ruby-identifier">ctx</span>, <span class="ruby-identifier">asm</span>, <span class="ruby-value">cause:</span>)
      <span class="ruby-ivar">@ocb</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">asm</span>)
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-initialize" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">initialize</span><span
                                class="method-args">(cb, ocb, compiler, exit_compiler)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Called by <a href="Compiler.html"><code>RubyVM::RJIT::Compiler</code></a> to lazily initialize this @param cb [CodeBlock] @param ocb [CodeBlock] @param compiler [RubyVM::RJIT::Compiler] @param exit_compiler [RubyVM::RJIT::ExitCompiler]</p>

                              <div class="method-source-code" id="initialize-source">
            <pre><span class="ruby-comment"># File ruby_vm/rjit/invariants.rb, line 11</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">cb</span>, <span class="ruby-identifier">ocb</span>, <span class="ruby-identifier">compiler</span>, <span class="ruby-identifier">exit_compiler</span>)
  <span class="ruby-ivar">@cb</span> = <span class="ruby-identifier">cb</span>
  <span class="ruby-ivar">@ocb</span> = <span class="ruby-identifier">ocb</span>
  <span class="ruby-ivar">@compiler</span> = <span class="ruby-identifier">compiler</span>
  <span class="ruby-ivar">@exit_compiler</span> = <span class="ruby-identifier">exit_compiler</span>
  <span class="ruby-ivar">@bop_blocks</span> = <span class="ruby-constant">Set</span>.<span class="ruby-identifier">new</span> <span class="ruby-comment"># TODO: actually invalidate this</span>
  <span class="ruby-ivar">@cme_blocks</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">h</span>, <span class="ruby-identifier">k</span><span class="ruby-operator">|</span> <span class="ruby-identifier">h</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-constant">Set</span>.<span class="ruby-identifier">new</span> }
  <span class="ruby-ivar">@const_blocks</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">h</span>, <span class="ruby-identifier">k</span><span class="ruby-operator">|</span> <span class="ruby-identifier">h</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-constant">Set</span>.<span class="ruby-identifier">new</span> }
  <span class="ruby-ivar">@patches</span> = {}

  <span class="ruby-comment"># freeze # workaround a binding.irb issue. TODO: resurrect this</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-on_cme_invalidate" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">on_cme_invalidate</span><span
                                class="method-args">(cme)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="on_cme_invalidate-source">
            <pre><span class="ruby-comment"># File ruby_vm/rjit/invariants.rb, line 69</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">on_cme_invalidate</span>(<span class="ruby-identifier">cme</span>)
  <span class="ruby-ivar">@cme_blocks</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">cme</span>.<span class="ruby-identifier">to_i</span>, []).<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">block</span><span class="ruby-operator">|</span>
    <span class="ruby-ivar">@cb</span>.<span class="ruby-identifier">with_write_addr</span>(<span class="ruby-identifier">block</span>.<span class="ruby-identifier">start_addr</span>) <span class="ruby-keyword">do</span>
      <span class="ruby-identifier">asm</span> = <span class="ruby-constant">Assembler</span>.<span class="ruby-identifier">new</span>
      <span class="ruby-identifier">asm</span>.<span class="ruby-identifier">comment</span>(<span class="ruby-string">&#39;on_cme_invalidate&#39;</span>)
      <span class="ruby-identifier">asm</span>.<span class="ruby-identifier">jmp</span>(<span class="ruby-identifier">block</span>.<span class="ruby-identifier">entry_exit</span>)
      <span class="ruby-ivar">@cb</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">asm</span>)
    <span class="ruby-keyword">end</span>
    <span class="ruby-comment"># TODO: re-generate branches that refer to this block</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-ivar">@cme_blocks</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">cme</span>.<span class="ruby-identifier">to_i</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-on_constant_ic_update" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">on_constant_ic_update</span><span
                                class="method-args">(iseq, ic, insn_idx)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="on_constant_ic_update-source">
            <pre><span class="ruby-comment"># File ruby_vm/rjit/invariants.rb, line 82</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">on_constant_ic_update</span>(<span class="ruby-identifier">iseq</span>, <span class="ruby-identifier">ic</span>, <span class="ruby-identifier">insn_idx</span>)
  <span class="ruby-comment"># TODO: check multi ractor as well</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">ic</span>.<span class="ruby-identifier">entry</span>.<span class="ruby-identifier">ic_cref</span>
    <span class="ruby-comment"># No need to recompile the slowpath</span>
    <span class="ruby-keyword">return</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">pc</span> = <span class="ruby-identifier">iseq</span>.<span class="ruby-identifier">body</span>.<span class="ruby-identifier">iseq_encoded</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">insn_idx</span>
  <span class="ruby-identifier">insn_name</span> = <span class="ruby-constant">Compiler</span>.<span class="ruby-identifier">decode_insn</span>(<span class="ruby-identifier">pc</span>.<span class="ruby-identifier">*</span>).<span class="ruby-identifier">name</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">insn_name</span> <span class="ruby-operator">!=</span> <span class="ruby-value">:opt_getconstant_path</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">insn_name</span> <span class="ruby-operator">!=</span> <span class="ruby-value">:trace_opt_getconstant_path</span>
    <span class="ruby-identifier">raise</span> <span class="ruby-string">&#39;insn_idx was not at opt_getconstant_path&#39;</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">ic</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">pc</span>[<span class="ruby-value">1</span>]
    <span class="ruby-identifier">raise</span> <span class="ruby-string">&#39;insn_idx + 1 was not at the updated IC&#39;</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-ivar">@compiler</span>.<span class="ruby-identifier">invalidate_blocks</span>(<span class="ruby-identifier">iseq</span>, <span class="ruby-identifier">pc</span>.<span class="ruby-identifier">to_i</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-on_constant_state_changed" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">on_constant_state_changed</span><span
                                class="method-args">(id)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="on_constant_state_changed-source">
            <pre><span class="ruby-comment"># File ruby_vm/rjit/invariants.rb, line 100</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">on_constant_state_changed</span>(<span class="ruby-identifier">id</span>)
  <span class="ruby-ivar">@const_blocks</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">id</span>, []).<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">block</span><span class="ruby-operator">|</span>
    <span class="ruby-ivar">@compiler</span>.<span class="ruby-identifier">invalidate_block</span>(<span class="ruby-identifier">block</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-on_tracing_invalidate_all" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">on_tracing_invalidate_all</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="on_tracing_invalidate_all-source">
            <pre><span class="ruby-comment"># File ruby_vm/rjit/invariants.rb, line 106</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">on_tracing_invalidate_all</span>
  <span class="ruby-identifier">invalidate_all</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-on_update_references" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">on_update_references</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="on_update_references-source">
            <pre><span class="ruby-comment"># File ruby_vm/rjit/invariants.rb, line 110</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">on_update_references</span>
  <span class="ruby-comment"># Give up. In order to support GC.compact, you&#39;d have to update ISEQ</span>
  <span class="ruby-comment"># addresses in BranchStub, etc. Ideally, we&#39;d need to update moved</span>
  <span class="ruby-comment"># pointers in JITed code here, but we just invalidate all for now.</span>
  <span class="ruby-identifier">invalidate_all</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-record_global_inval_patch" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">record_global_inval_patch</span><span
                                class="method-args">(asm, target)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>@param asm [RubyVM::RJIT::Assembler]</p>

                              <div class="method-source-code" id="record_global_inval_patch-source">
            <pre><span class="ruby-comment"># File ruby_vm/rjit/invariants.rb, line 60</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">record_global_inval_patch</span>(<span class="ruby-identifier">asm</span>, <span class="ruby-identifier">target</span>)
  <span class="ruby-identifier">asm</span>.<span class="ruby-identifier">pos_marker</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">address</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">if</span> <span class="ruby-ivar">@patches</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-identifier">address</span>)
      <span class="ruby-identifier">raise</span> <span class="ruby-string">&#39;multiple patches in the same address&#39;</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-ivar">@patches</span>[<span class="ruby-identifier">address</span>] = <span class="ruby-identifier">target</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="private-class-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Private Class Methods</h3>
                </header>

                  <div id="method-c-invalidate_all" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">invalidate_all</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="invalidate_all-source">
            <pre><span class="ruby-comment"># File ruby_vm/rjit/invariants.rb, line 131</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">invalidate_all</span>
  <span class="ruby-comment"># On-Stack Replacement</span>
  <span class="ruby-ivar">@patches</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">address</span>, <span class="ruby-identifier">target</span><span class="ruby-operator">|</span>
    <span class="ruby-comment"># TODO: assert patches don&#39;t overlap each other</span>
    <span class="ruby-ivar">@cb</span>.<span class="ruby-identifier">with_write_addr</span>(<span class="ruby-identifier">address</span>) <span class="ruby-keyword">do</span>
      <span class="ruby-identifier">asm</span> = <span class="ruby-constant">Assembler</span>.<span class="ruby-identifier">new</span>
      <span class="ruby-identifier">asm</span>.<span class="ruby-identifier">comment</span>(<span class="ruby-string">&#39;on_tracing_invalidate_all&#39;</span>)
      <span class="ruby-identifier">asm</span>.<span class="ruby-identifier">jmp</span>(<span class="ruby-identifier">target</span>)
      <span class="ruby-ivar">@cb</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">asm</span>)
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-ivar">@patches</span>.<span class="ruby-identifier">clear</span>

  <span class="ruby-constant">C</span>.<span class="ruby-identifier">rjit_for_each_iseq</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">iseq</span><span class="ruby-operator">|</span>
    <span class="ruby-comment"># Avoid entering past code</span>
    <span class="ruby-identifier">iseq</span>.<span class="ruby-identifier">body</span>.<span class="ruby-identifier">jit_entry</span> = <span class="ruby-value">0</span>
    <span class="ruby-comment"># Avoid reusing past code</span>
    <span class="ruby-identifier">iseq</span>.<span class="ruby-identifier">body</span>.<span class="ruby-identifier">rjit_blocks</span>.<span class="ruby-identifier">clear</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">iseq</span>.<span class="ruby-identifier">body</span>.<span class="ruby-identifier">rjit_blocks</span>
    <span class="ruby-comment"># Compile this again if not converted to trace_* insns</span>
    <span class="ruby-identifier">iseq</span>.<span class="ruby-identifier">body</span>.<span class="ruby-identifier">jit_entry_calls</span> = <span class="ruby-value">0</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

              </section>
              </main>



            </div>  <!--  class='wrapper hdiv' -->


<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.</p>
<p>Based on <a href="https://github.com/ged/darkfish/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>

  
    <p><p><a href="https://ruby-doc.org">Ruby-doc.org</a> is provided by <a href="https://jamesbritt.com">James Britt</a> and <a href="https://neurogami.com">Neurogami</a>. </p><p><a href="https://jamesbritt.bandcamp.com/">Hack your world.  Feed your head.  Live curious</a>.</p>
</p>
  
  </footer>

<script type="text/javascript">


  let ads  = $("#carbonads-container").children().detach();


  function swapMode() {
    var cookieName = 'darkmode';
    var cssDarkmode = Cookies.get(cookieName);
    console.log("***** swapMode! " + cssDarkmode + " *****");


    if (cssDarkmode == "true") {
      console.log("We have dark mode, set the css to light ...");
      $('#rdoccss').attr("href", defaultModeCssHref);
      $('#cssSelect').text("Dark mode");
      cssDarkmode = "false";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    } else {
      console.log("We not have dark mode, set the css to dark ...");
      $('#rdoccss').attr("href", darkModeCsseHref);
      $('#cssSelect').text("Light mode");
      cssDarkmode = "true";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    }

    console.log("  --------------- ");
  }


const vueCssApp = new Vue({
el: '#menubar',
data: {
isDark: false
},
methods: {
toggleClass: function(event){
this.isDark = !this.isDark;
}
}
})

const vueApp = new Vue({
el: '#vapp',
data: { 
isOpen: true
},

mounted() {
this.handleResize();
this.manage_mob_classes();
window.addEventListener('resize', this.handleResize)
//this.isOpen !=  (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
destroyed() {
window.removeEventListener('resize', this.handleResize)
},
created() {
//manage_mob_classes();
},

methods : {
isMobile() {
  return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},

  handleResize() {
    if (!this.isMobile()) {
      this.isOpen = window.innerWidth > 800;
    }
  },

  manage_mob_classes() {
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
      $("nav").addClass("mob_nav");
      $("main").addClass("mob_main");
      $("#extraz").addClass("mob_extraz");
      $("#carbonads-container").addClass("mob_carbonads-container");
      this.isOpen  = false;
    } else {
      $("nav").removeClass("mob_nav") 
        $("main").removeClass("mob_main");
      $("#extraz").removeClass("mob_extraz");
      $("#carbonads-container").removeClass("mob_carbonads-container");
      this.isOpen  = true;
    }
  },

  toggleNav() {
    this.isOpen =! this.isOpen ;
    // alert("Toggle nav!");
    console.log("toggleNav() click: " + this.isOpen );
  }
}
})

$("#carbonads-container").append(ads);


$(function() {

    var darkmode = Cookies.get("darkmode");
    console.log("Document ready: " + darkmode);

    if ( darkmode  == "true" ) {
      $('#cssSelect').text("Light mode");
    } else {
      $('#cssSelect').text("Dark mode");
     }

    $('body').css('display','block');
    });

</script>

    
  </body> 
</html>

